package com.dibang.app.operation.control.impl;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.dibang.app.R;
import com.dibang.app.mvp.abs.AbsControl;
import com.dibang.app.operation.control.abs.LoginSmsControl;
import com.dibang.app.operation.model.abs.LoginSmsModel;
import com.dibang.app.operation.presenter.abs.LoginSmsPresenter;
import com.dibang.app.operation.provider.LoginSmsProImpl;
import com.dibang.app.operation.view.abs.LoginSmsView;
import com.dibang.app.view.AppKeyBoardUtil;
import com.dibang.app.view.CountDownTextView;
import com.dibang.app.view.ViewHelper;
import com.dx.dxloadingbutton.lib.LoadingButton;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by wxl on 2019/7/19.
 *
 */

public class LoginSmsControlImpl extends AbsControl<LoginSmsView,LoginSmsPresenter,LoginSmsModel,LoginSmsProImpl> implements LoginSmsControl {


    @BindView(R.id.login_sms_submit_view)
    LoadingButton submitLogin;

    @BindView(R.id.login_sms_resend_code_view)
    CountDownTextView countDownTextView;

    @BindView(R.id.login_sms_code_input_view)
    EditText codeInputView;

    @BindView(R.id.login_sms_mobile_text_view)
    TextView mobileView;

    public LoginSmsControlImpl(@NonNull View targetView) {
        super(targetView);
        ButterKnife.bind(this,targetView);
        ViewHelper.setLoadingButtonBackgroundShader(submitLogin);
        getView().onCountDownTimeViewExpandAndStart(countDownTextView,mobileView);
    }


    @OnClick(R.id.login_sms_submit_view)
    public void onSubmitClick(View v){
        AppKeyBoardUtil.hideKeybord(codeInputView);
    }


    @Override
    public void onDestroy() {
        AppKeyBoardUtil.hideKeybord(codeInputView);
        super.onDestroy();
    }
}
